#region using statements
using System;
using System.Runtime.InteropServices;
using System.Security.Permissions;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Security;

using Microsoft.Office.Word.Server.Conversions;
using Microsoft.Office.Word.Server.Service;
#endregion

namespace WordServicesUIExtensions
{
    /// <summary>
    /// This class handles events raised during feature activation, deactivation, installation, uninstallation, and upgrade.
    /// </summary>
    /// <remarks>
    /// The GUID attached to this class may be used during packaging and should not be modified.
    /// </remarks>
    [Guid("4f2d23fe-b045-41b3-838f-6899b979a8cb")]
    public class SaveAsEventReceiver : SPFeatureReceiver
    {
        /// <summary>
        /// check to see if Word Automation Services Service application exists
        /// </summary>
        /// <param name="properties"></param>
        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            if (SPServiceContext.Current == null) return;
            WordServiceApplicationProxy proxy = SPServiceContext.Current.GetDefaultProxy(typeof(WordServiceApplicationProxy)) as WordServiceApplicationProxy;
            if (proxy == null)
            {
                throw new ApplicationException("Missing Word Automation Services Service application");
            }
        }

    }
}
